#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalShader.h"


class SkyboxProcess : public RenderProcess
{
	DECLARE_PROCESS(SkyboxProcess)

	struct Ubo
	{
		glm::mat4 proj;
		glm::mat4 model;
		glm::mat4 invModel;
	};

	struct VertexPosNormal
	{
		glm::vec3 pos;
		glm::vec3 normal;
	};

public:

	float mExposure;

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:

	RefCountPtr<VertexBuffer> mVertexBuffer;

	RefCountPtr<IndexBuffer> mIndexBuffer;

	RefCountPtr<RHIBuffer> mUboBuffer;

	RefCountPtr<RHIBuffer> mExposureBuffer;

	RefCountPtr<RHISampler> mHdrSampler;

	RefCountPtr<RHITexture> mHdrTexture;

	RefCountPtr<ColorRenderTarget> mColorRenderTarget0;

	RefCountPtr<ColorRenderTarget> mColorRenderTarget1;

	RefCountPtr<DepthRenderTarget> mDepthRenderTarget;

	ShaderPtr<HdrVertexShader> mHdrVertexShader;

	ShaderPtr<HdrFragmentShader> mHdrFragmentShader;

	RefCountPtr<RHIDescriptor> mDescriptor;

	DescriptorMask mDescriptorMask;

	RefCountPtr<GraphicsPipeline> mPipeline;

	RefCountPtr<RHIRenderPass> mRenderPass;

	RefCountPtr<RHIFrameBuffer> mFrameBuffer;
};
